package com.xuzao.developer.dao.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xuzao.developer.base.criteria.ProjectVersionCriteria;
import com.xuzao.developer.base.model.ProjectVersion;
import com.xuzao.developer.dao.ProjectVersionDao;
import com.xuzao.developer.dto.ProjectVersionDTO;
import com.xuzao.developer.mapper.ProjectVersionMapper;
import com.xuzao.developer.tools.base.BaseServiceSupport;
import com.xuzao.developer.tools.entity.Pager;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;


/**
 * @description 
 * @author xuzao
 * @date 2019-08-09 18:12:00
 **/
@Service("projectVersionDao")
public class ProjectVersionDaoImpl extends BaseServiceSupport<ProjectVersion> implements ProjectVersionDao {

	@Resource
	private ProjectVersionMapper projectVersionMapper;


	@Override
	public PageInfo<ProjectVersion> list(ProjectVersionDTO dto, Pager pager) {
		ProjectVersionCriteria criteria = this.assemblyQuerycond(dto);
		if (null != pager) {
			if (null != pager.getPageSize() && null != pager.getPageIndex()) {
				PageHelper.startPage(pager.getPageIndex(), pager.getPageSize());
			}
		}
		PageInfo<ProjectVersion> pageInfo = new PageInfo<>(this.projectVersionMapper.selectByExample(criteria));
		return pageInfo;
	}

	//通用查询方法条件组装
	public ProjectVersionCriteria assemblyQuerycond(ProjectVersionDTO dto) {
		ProjectVersionCriteria criteria = new ProjectVersionCriteria();
		ProjectVersionCriteria.Criteria c = criteria.createCriteria();

		if (null != dto) {

		}
		return criteria;
	}
}